package com.cyanite.playlv2.maps;

import com.cyanite.playlv2api.types.PlayLv2Type;
import com.cyanite.playlv2api.types.Group;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.MapView;
import com.google.android.maps.OverlayItem;
import android.graphics.drawable.Drawable;

abstract class BaseGroupItemizedOverlay<T extends PlayLv2Type> extends ItemizedOverlay<OverlayItem> {

    Group<T> group = null;
    public BaseGroupItemizedOverlay(Drawable defaultMarker) {
        super(boundCenterBottom(defaultMarker));
    }

    @Override
    public int size() {
        if (group == null) {
            return 0;
        }
        return group.size();
    }

    @Override
    public boolean onTap(GeoPoint p, MapView mapView) {
        return super.onTap(p, mapView);
    }

    @Override
    protected boolean onTap(int i) {
        return super.onTap(i);
    }

    public void setGroup(Group<T> g) {
        assert g.getType() != null;
        group = g;
        super.populate();
    }
}
